import request from './request'

// 获取用户列表
// var getUserList = (query = {}) {
// 	return request.get('/index/index/index', query)
// }
//获取列表分页
var getUserList = query => {
	return new Promise((res, rej) => {
		request.getlist('http://47.94.4.201/index.php/index/teacher/teacherlist', query)
			.then(a => {
				res(a)
			}).catch(err => {
				rej(err)
			})
	})
}
//添加
var addUserList = query => {
	return new Promise((res, rej) => {
		request.add('http://47.94.4.201/index.php/index/index/addteacher', query)
			.then(a => {
				res(a)
			}).catch(err => {
				rej(err)
			})
	})
}
//删除
var delUserList = query => {
	return new Promise((res, rej) => {
		request.del('http://47.94.4.201/index.php/index/teacher/delteacher', query)
			.then(a => {
				res(a)
			}).catch(err => {
				rej(err)
			})
	})
}
//详情
var detaUserList = query => {
	return new Promise((res, rej) => {
		request.details('http://47.94.4.201/index.php/index/index/getteacherbyid', query)
			.then(a => {
				res(a)
			}).catch(err => {
				rej(err)
			})
	})
}
//修改
var updataUserList = (data) => {
	return new Promise((res, rej) => {
		request.updata('http://47.94.4.201/index.php/index/index/upteacher', data)
			.then(a => {
				res(a)
			}).catch(err => {
				rej(err)
			})
	})
}
//搜索
var lookoutUserList = (data) => {
	return new Promise((res, rej) => {
		request.search('http://47.94.4.201/index.php/index/teacher/getsearch', data)
			.then(a => {
				res(a)
			}).catch(err => {
				rej(err)
			})
	})
}
export default {
	getUserList,
	addUserList,
	delUserList,
	detaUserList,
	updataUserList,
	lookoutUserList
}